<template>
  <div class="w-full px-20px bg-white text-14px">
    <div class="overflow-hidden">
      <div class="flex pl-25px mt-20px">
        <div class="w-100px ml-5px">店名称：</div>
        <div>{{ Info.shop_name }}</div>
      </div>
      <div class="flex pl-25px mt-20px">
        <div class="w-100px ml-5px">当前店前缀：</div>
        <div>{{ Info.shop_prefix }}</div>
      </div>
      <div class="flex pl-25px mt-20px">
        <div class="w-100px ml-5px">店登录号：</div>
        <div>{{ Info.shop_no }}</div>
      </div>
      <van-cell-group inset>
        <!-- <van-field
          v-model="value"
          label="店名称："
          placeholder="请输入用户名"
        />
        <van-field
          v-model="value"
          label="当前店前缀："
          placeholder="请输入用户名"
        />
        <van-field
          v-model="value"
          label="店登录号："
          placeholder="请输入用户名"
        /> -->
        <van-field
          lable-width="100"
          v-model="no"
          label="新编号："
          type="digit"
          placeholder="请输入6位数字编号"
          maxlength="6"
        />
      </van-cell-group>
    </div>
    <div
      @click="sumbit"
      class="w-full bg-[#2E95FF] flex justify-center items-center rounded-5px text-white h-49px mt-30px"
    >
      确认修改
    </div>
    <div class="mt-20px pb-10px">
      <div class="text-18px font-bold mb-10px">备注：</div>
      <span class="text-10px"
        >店前缀无法修改，只能更改后面的编码，只能输入数字！
        如：ZHD123456，后面数字123456可以设置，前缀ZHD无法 变更。</span
      >
    </div>
  </div>
</template>
<script setup>
import { userShopInfo, editShop } from "@/util/api";
import { showToast } from "vant";
import { useRouter } from "vue-router";
const Info = reactive({
  shop_name: "", //店铺名称
  shop_prefix: "", //店铺编号前缀
  shop_no: "", //店铺号
});
const router = useRouter();
const no = ref("");
const getData = async () => {
  const res = await userShopInfo();
  for (let i in Info) {
    Info[i] = res.msg[i];
  }
  // console.log(res);
};
getData();
const sumbit = async () => {
  const res = await editShop({ no: no.value });
  showToast(res.msg);
  res.code == 1 ? router.go(-1) : "";
};
</script>
